<?php
/**
 * Common library class
 */
class Common {

    static public $dateText = array();
    const PRODUCT   =   0;
    const ARTICLE   =   1;
    
    static function catArray($label = '') {
        $array = array();
        if ($label) $array[''] = $label;
        $array[self::PRODUCT] = Yii::t('Global', 'Product');
        $array[self::ARTICLE] = Yii::t('Global', 'Article');
        return $array;
    }
    public function catName($hot) {
        $array = self::catArray();
        return $array[$hot];
    }
    
    const menu_0 = 0;//Menu ngang
    const menu_1 = 1;//Hãng Điện thoại
    const menu_2 = 2;//Danh mục phụ kiện
    const menu_3 = 3;//Thông tin Vtphone
    const menu_4 = 4;//Thông tin vận chuyển
    const menu_5 = 5;//Chính xác công ty
    const menu_6 = 6;//Dịch vụ khách hàng
    
    public static function parent_menu_arr($label = ''){
        $array = array();
        if ($label) $array[''] = $label;
        $array[self::menu_0] = 'Menu ngang';
        $array[self::menu_1] = 'Hãng Điện thoại';
        $array[self::menu_2] = 'Danh mục phụ kiện';
        $array[self::menu_3] = 'Thông tin Vtphone';
        $array[self::menu_4] = 'Thông tin vận chuyển';
        $array[self::menu_5] = 'Chính xác công ty';
        $array[self::menu_6] = 'Dịch vụ khách hàng';
        return $array;
    }

    /**
     *
     * Load language message by category
     * @param STRING $category
     * @return ARRAY
     */
    public static function loadMessages($category) {
        $languageFile = Yii::app()->getBasePath() . DIRECTORY_SEPARATOR . "messages" . DIRECTORY_SEPARATOR . Yii::app()->getLanguage() . DIRECTORY_SEPARATOR . "{$category}.php";
        if (!file_exists($languageFile))
            $languageFile = Yii::app()->getBasePath() . DIRECTORY_SEPARATOR . "messages" . DIRECTORY_SEPARATOR . Yii::app()->getLanguage() . DIRECTORY_SEPARATOR . "FrontEnd.php.php";
        return require($languageFile);
    }

    public function highlight($x, $var) {
        $var = explode(" ", $var);
        for ($j = 0; $j < count($var); $j++) {
            $xtemp = "";
            $i = 0;
            while ($i < strlen($x)) {
                if ((($i + strlen($var[$j])) <= strlen($x)) && (strcasecmp($var[$j], substr($x, $i, strlen($var[$j]))) == 0)) {
                    $xtemp .= "<b>" . substr($x, $i, strlen($var[$j])) . "</b>";
                    $i += strlen($var[$j]);
                } else {
                    $xtemp .= $x{$i};
                    $i++;
                }
            }
            $x = $xtemp;
        }
        return $x;
    }

    /**
     *
     * make user fullname from firstname and lastname, displayed independen by language
     * @param User Object $user(id, firstname, lastname)
     * @return string
     */
    public static function makeFullname($firstname, $lastname) {
        if ((!$firstname) && (!$lastname))
            return '';
        if (Yii::app()->language == 'en_us') {
            $fullname = $lastname . " " . $firstname;
        } else {
            $fullname = $firstname . " " . $lastname;
        }

        return trim($fullname);
    }

    /**
     * Get newnest position function
     * @return number|number
     */
    public static function getNewestPosition($model) {
        $position = 0;
        if ($model) {
            $criteria = new CDbCriteria();
            $criteria->select = "sorder";
            $criteria->order = "sorder";
            $items = $model->findAll($criteria);
            $position = 1;
            foreach ($items as $item) {
                if ($position != $item->sorder) {
                    return $position;
                }
                $position++;
            }
        }
        return $position;
    }

    /**
     *
     * Create an url string
     * @staticvar ARRAY $charMap
     * @param STRING $string
     * @return STRING
     */
    public static function makeFriendlyUrl($str, $allowUnder = false) {
        $str = strip_tags(trim($str));
        $str = preg_replace("/(À|Á|Ạ|Ả|Ã|Â|Ầ|Ấ|Ậ|Ẩ|Ẫ|Ă|Ằ|Ắ|Ặ|Ẳ|Ẵ)/", 'A', $str);
        $str = preg_replace("/(È|É|Ẹ|Ẻ|Ẽ|Ê|Ề|Ế|Ệ|Ể|Ễ)/", 'E', $str);
        $str = preg_replace("/(Ì|Í|Ị|Ỉ|Ĩ)/", 'I', $str);
        $str = preg_replace("/(Ò|Ó|Ọ|Ỏ|Õ|Ô|Ồ|Ố|Ộ|Ổ|Ỗ|Ơ|Ờ|Ớ|Ợ|Ở|Ỡ)/", 'O', $str);
        $str = preg_replace("/(Ù|Ú|Ụ|Ủ|Ũ|Ư|Ừ|Ứ|Ự|Ử|Ữ)/", 'U', $str);
        $str = preg_replace("/(Ỳ|Ý|Ỵ|Ỷ|Ỹ)/", 'Y', $str);
        $str = preg_replace("/(Đ)/", 'D', $str);
        $str = preg_replace("/(à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ)/", 'a', $str);
        $str = preg_replace("/(è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ)/", 'e', $str);
        $str = preg_replace("/(ì|í|ị|ỉ|ĩ)/", 'i', $str);
        $str = preg_replace("/(ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ)/", 'o', $str);
        $str = preg_replace("/(ù|ú|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ)/i", 'u', $str);
        $str = preg_replace("/(ỳ|ý|ỵ|ỷ|ỹ)/", 'y', $str);
        $str = preg_replace("/(đ)/", 'd', $str);
        $str = preg_replace(array('#(amp;|quot;|;)#', '#[^\d\w- ]#'), '', $str);
        $str = str_replace(array(" ", "----", "---", "--"), "-", trim($str));
        $str = strtolower($str);
        return $str;
    }

    public static function cleanUpSpecialChars($string, $allowUnder = false) {
        $regExpression = "`\W`i";
        if ($allowUnder)
            $regExpression = "`[^a-zA-Z0-9-]`i";
        $string = preg_replace(array($regExpression, "`[-]+`",), "-", $string);
        return trim($string, '-');
    }

    /**
     *
     * @param object $uploadedFile
     * @param string $targetFile
     * @return array(
     *      'code' => 1, // 1= true, 0 = false
     *      'message' => 'some message'
     * )
     */
    public static function uploadImage($uploadedFile, $targetFile, $isImage = false) {
        if ($uploadedFile['name']) {
            $error = "";
            if (!$uploadedFile)
                $error = Yii::t('BackEnd', 'No input file');;
            $limitFileSize = Yii::app()->params['maxUploadFileSize'];
            if (!$isImage)
                $supportMineTypes = Yii::app()->params['supportMineTypes'];
            else
                $supportMineTypes = array("image/gif", "image/jpeg", "image/png", "image/bmp", "image/jp2");
            // validate image
            if ($uploadedFile) {
                if ($uploadedFile['size'] > $limitFileSize) {
                    $error = Yii::t('BackEnd', 'File too big') . '(' . $uploadedFile['size'] . ')';
                }
                if ($uploadedFile['error'] != UPLOAD_ERR_OK) {
                    $error = Yii::t('FronBackEndtEnd', 'Error on uploading');
                }

                if (!in_array($uploadedFile['type'], $supportMineTypes)) {
                    $error = Yii::t('BackEnd', 'Not supported file type');
                }
            }

            // save image
            if ($error != "") {
                return array(
                    'code' => 0,
                    'message' => $error,
                );
            } else {
                $tmpName = $uploadedFile["tmp_name"];
                move_uploaded_file($tmpName, $targetFile);
                return array(
                    'code' => 1,
                    'message' => Yii::t('FrontEnd', 'Success'),
                );
            }
        }

        return array(
            'code' => 0,
            'message' => Yii::t('FrontEnd', 'No file'),
        );
    }

    public static function uploadImageFromArray($uploadedFiles, $fileIndex, $targetFile) {
        $error = "";
        if (!$uploadedFiles)
            $error = Yii::t('BackEnd', 'No input file');;

        $limitFileSize = Yii::app()->params['maxUploadFileSize'];
        $supportMineTypes = Yii::app()->params['supportMineTypes'];
        // validate image
        if ($uploadedFiles) {
            if ($uploadedFiles['size'][$fileIndex]['file'] > $limitFileSize) {
                $error = Yii::t('BackEnd', 'File too big') . '(' . $uploadedFiles['size'][$fileIndex]['file'] . ')';
            }
            if ($uploadedFiles['error'][$fileIndex]['file'] != UPLOAD_ERR_OK) {
                $error = Yii::t('BackEnd', 'Error on uploading');
            }

            if (!in_array($uploadedFiles['type'][$fileIndex]['file'], $supportMineTypes)) {
                $error = Yii::t('BackEnd', 'Not supported file type');
            }
        }

        // save image
        if ($error != "") {
            return array(
                'code' => 0,
                'message' => $error,
            );
        } else {
            $sourceFile = $uploadedFiles["tmp_name"][$fileIndex]['file'];
            //echo $fileIndex."|".$sourceFile."|".$targetFile;die();
            move_uploaded_file($sourceFile, $targetFile);
            return array(
                'code' => 1,
                'message' => Yii::t('BackEnd', 'Upload successfully.'),
            );
        }
    }

    /**
     * Resize a image function
     */
    public static function resize($image_in, $image_out, $options = array(), $crop = 1) {
        //Check if GD extension is loaded
        if (!extension_loaded('gd') && !extension_loaded('gd2')) {
            trigger_error(Yii::t('BackEnd', "GD is not loaded."), E_USER_WARNING);
            return false;
        }
        if (file_exists($image_in)) {
            $imgInfo = getimagesize($image_in);
            switch ($imgInfo[2]) {
                case 1: $im = imagecreatefromgif($image_in);
                    break;
                case 2: $im = imagecreatefromjpeg($image_in);
                    break;
                case 3: $im = imagecreatefrompng($image_in);
                    break;
                default: trigger_error(Yii::t('BackEnd', 'Unsupported filetype!'), E_USER_WARNING);
                    break;
            }
            $width = $imgInfo[0];
            $height = $imgInfo[1];
            $max_width = $options['width'];
            $max_height = $options['height'];
            if ((!$max_width && !$max_height) || ($options['width'] > $width && $options['height'] > $height)) {
                $max_width = $width;
                $max_height = $height;
            } else {
                if (!$max_width)
                    $max_width = 1000;
                if (!$max_height)
                    $max_height = 1000;
            }
            $x_ratio = $max_width / $width;
            $y_ratio = $max_height / $height;
            $dst = new stdClass();
            $src = new stdClass();
            $src->y = $src->x = 0;
            $dst->y = $dst->x = 0;
            if ($crop) {
                $dst->w = $max_width;
                $dst->h = $max_height;
                if (($width <= $max_width) && ($height <= $max_height)) {
                    $src->w = $max_width;
                    $src->h = $max_height;
                } else {
                    if ($x_ratio < $y_ratio) {
                        $src->w = ceil($max_width / $y_ratio);
                        $src->h = $height;
                    } else {
                        $src->w = $width;
                        $src->h = ceil($max_height / $x_ratio);
                    }
                }
                $src->x = floor(($width - $src->w) / 2);
                $src->y = floor(($height - $src->h) / 2);
            } else {
                $src->w = $width;
                $src->h = $height;
                if (($width <= $max_width) && ($height <= $max_height)) {
                    $dst->w = $width;
                    $dst->h = $height;
                } else if (($x_ratio * $height) < $max_height) {
                    $dst->h = ceil($x_ratio * $height);
                    $dst->w = $max_width;
                } else {
                    $dst->w = ceil($y_ratio * $width);
                    $dst->h = $max_height;
                }
            }

            $newImg = imagecreatetruecolor($dst->w, $dst->h);
            /* Check if this image is PNG or GIF, then set if Transparent */
            if (($imgInfo[2] == 1) OR ($imgInfo[2] == 3)) {
                imagealphablending($newImg, false);
                imagesavealpha($newImg, true);
                $transparent = imagecolorallocatealpha($newImg, 255, 255, 255, 127);
                imagefilledrectangle($newImg, 0, 0, $dst->w, $dst->h, $transparent);
            }
            imagecopyresampled($newImg, $im, $dst->x, $dst->y, $src->x, $src->y, $dst->w, $dst->h, $src->w, $src->h);

            //Generate the file, and rename it to $newfilename
            switch ($imgInfo[2]) {
                case 1: {
                        imagegif($newImg, $image_out);
                        break;
                    }
                case 2: {
                        imagejpeg($newImg, $image_out, 90);
                        break;
                    }
                case 3: {
                        imagepng($newImg, $image_out);
                        break;
                    }
                default: return '';
                    break;
            }
            imagedestroy($newImg);
        }
    }

    /**
     *
     * Convert server request uri to search string
     * @param string $uri
     * @return string
     */
    public static function uriToString($uri) {
        $string = $uri;
        $string = preg_replace(array("`[^\p{L}]`u", "`[\ ]+`"), " ", $string);
        $arr = explode(" ", trim($string));
        $string = implode(" ", array_unique($arr));
        return $string;
    }

    public static function buildUrl($path = "/", $params = array()) {
        return urldecode(Yii::app()->createUrl($path, $params));
    }

    public static function sendEmail($emailTemplateCode, $params = array()) {
        Yii::import('application.components.phpMailer.*');
        if (!empty($emailTemplateCode)) {
            // Get email template
            $emailTemp = EmailTemplate::model()->find("code = '{$emailTemplateCode}' AND status=" . Lvc::STATUS_ENABLED);
        }
        if ($emailTemp->id > 0) {
            $to = array();
            $to[] = $params['to_email'];
            $now = date('dmY-Hms');
            $subject = $emailTemp->subject . " - " . $now;
            $from = $emailTemp->from;
            $message = $emailTemp->body;
            if ($params && is_array($params)) {
                foreach ($params as $key => $value) {
                    $message = str_replace("{{$key}}", $value, $message);
                }
            }
            $mail = new PHPMailer();
            $mail->Mailer = "smtp";
            $mail->Host = "smtp.gmail.com";
            $mail->Port = 465;
            $mail->SMTPSecure = 'ssl';
            $mail->SMTPAuth = true; // turn on SMTP authentication
            $mail->Username = (Yii::app()->params['gmailInfo']["username"]) ? Yii::app()->params['gmailInfo']["username"] : ""; // SMTP username
            $mail->Password = (Yii::app()->params['gmailInfo']["password"]) ? Yii::app()->params['gmailInfo']["password"] : ""; // SMTP passwor
            $mail->CharSet = "utf-8";
            //$from_name = substr($from, 0, strpos($from, '@'));
            $from_name = "Aboutsvietnam.com";
            $mail->SetFrom($from, $from_name);
            $mail->set('Sender', $from);
            $mail->Subject = $subject;
            $mail->MsgHTML($message);
            $mail->SetWordWrap();

            if (count($to) == 0 && isset($params['email']))
                $to[] = $params['email'];
            foreach ($to as $address) {
                $headers = "MIME-Version: 1.0\r\n";
                $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
                if (strpos($address, '<') > 0 && strpos($address, '>') > 0) {
                    $headers .= "To: $address\r\n";
                    $current_name = substr($address, 0, strpos($address, '<') - 1);
                    $current_address = substr($address, (strpos($address, '<') + 1), ((strpos($address, '>') - strpos($address, '<')) - 1));
                    $mail->AddAddress($current_address, $current_name);
                } else { // For email format: abc@abc.com
                    $current_name = $address;
                    $headers .= "To: $current_name<$address>\r\n";
                    $mail->AddAddress($address, $current_name);
                }
                $headers .= "From: {$from_name}<{$from}>\r\n";
                if (!$mail->Send()) {
                    $msg = 'Send mail error (' . date('d-m-Y H:i:s') . ') - header: ' . $headers . '<br/>' . $subject . '<br/>' . $message . '<br/><hr/>';
                    Yii::log($msg, 'error');
                } else {
                    $msg = 'Send mail success (' . date('d-m-Y H:i:s') . ') - header: ' . $headers . '<br/>' . $subject . '<br/>' . $message . '<br/><hr/>';
                    Yii::log($msg, 'error');
                }
            }
        }
    }

    public function dumpAllHtmlTagToArray($label = '') {
        $array = array();
        if ($label)
            $array[''] = $label;
        $array['textField'] = Yii::t('BackEnd', 'Text field');
        $array['dateField'] = Yii::t('BackEnd', 'Date field');
        $array['textArea'] = Yii::t('BackEnd', 'Text area');
        $array['radioList'] = Yii::t('BackEnd', 'Radio list');
        $array['dropDownList'] = Yii::t('BackEnd', 'Drop down list');
        return $array;
    }

    public static function getHtmlTagName($tag) {
        $array = self::dumpAllHtmlTagToArray();
        return $array[$tag];
    }

    //Using for common gii and icon of index,admin,list,view,update,create
    public static function icon($type) {
        $icon = array(
            'manager' => '<img src="' . Yii::app()->request->baseUrl . '/css/admin/images/icons/18_12x12.png" class="icon" />&nbsp;' . Yii::t('Global', 'Manage'),
            'create' => '<img src="' . Yii::app()->request->baseUrl . '/css/admin/images/icons/create_12x12.png" class="icon" />&nbsp;' . Yii::t('Global', 'Create'),
            'delete' => '<img src="' . Yii::app()->request->baseUrl . '/css/admin/images/icons/delete_12x12.png" class="icon" />&nbsp;' . Yii::t('Global', 'Delete'),
            'list' => '<img src="' . Yii::app()->request->baseUrl . '/css/admin/images/icons/12_12x12.png" class="icon" />&nbsp;' . Yii::t('Global', 'List'),
            'title' => '<img src="' . Yii::app()->request->baseUrl . '/css/admin/images/icons/1_16x16.png" class="icon" />&nbsp;',
            'update' => '<img src="' . Yii::app()->request->baseUrl . '/css/admin/images/icons/edit_12x12.png" class="icon" />&nbsp;' . Yii::t('Global', 'Update'),
            'save' => '<img src="' . Yii::app()->request->baseUrl . '/css/admin/images/icons/20_12x12.png" class="icon" />&nbsp;' . Yii::t('Global', 'Save'),
            'reset' => '<img src="' . Yii::app()->request->baseUrl . '/css/admin/images/icons/reset_12x12.png" class="icon" />&nbsp;' . Yii::t('Global', 'Reset'),
        );
        return $icon[$type];
    }

    public static function clearData($data, $striptag = false) {
        $p = new CHtmlPurifier();
        if ($striptag)
            $data = strip_tags($data);
        $data = $p->purify($data);
        return $data;
    }

    public static function currentUrl() {
        $pageURL = 'http';
        if (isset($_SERVER["HTTPS"]))
            $pageURL .= "s";
        $pageURL .= "://";
        if ($_SERVER["SERVER_PORT"] != "80")
            $pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
        else
            $pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
        return $pageURL;
    }

    public static function uploadFile($uploadedFile, $targetFile) {
        if ($uploadedFile['name']) {
            $error = "";
            if (!$uploadedFile)
                $error = Yii::t('BackEnd', 'No input file');;
            $limitFileSize = Yii::app()->params['maxUploadFileSize'];
            $supportMineTypes = array(
                "application/msword",
                "application/rtf",
                "application/vnd.ms-excel",
                'application/vnd.ms-excel',
                "application/vnd.ms-powerpoint",
                "application/vnd.oasis.opendocument.text",
                'application/zip',
                'application/x-rar-compressed',
                'application/pdf',
                'text/plain'
            );

            // validate image
            if ($uploadedFile) {
                if ($uploadedFile['size'] > $limitFileSize) {
                    $error = Yii::t('BackEnd', 'File too big') . '(' . $uploadedFile['size'] . ')';
                }
                if ($uploadedFile['error'] != UPLOAD_ERR_OK) {
                    $error = Yii::t('FronBackEndtEnd', 'Error on uploading');
                }

                if (!in_array($uploadedFile['type'], $supportMineTypes)) {
                    $error = Yii::t('BackEnd', 'Not supported file type');
                }
            }

            // save image
            if ($error != "") {
                return array(
                    'code' => 0,
                    'message' => $error,
                );
            } else {
                $tmpName = $uploadedFile["tmp_name"];
                move_uploaded_file($tmpName, $targetFile);
                return array(
                    'code' => 1,
                    'message' => Yii::t('FrontEnd', 'Success'),
                );
            }
        }

        return array(
            'code' => 0,
            'message' => Yii::t('FrontEnd', 'No file'),
        );
    }

    /**
     * @return YII_CSRF_TOKEN
     */
    public static function Token() {
        $token = (Yii::app()->request->enableCsrfValidation) ? Yii::app()->request->getCsrfToken() : '';
        return 'var YII_CSRF_TOKEN ="' . $token . '";';
    }

    public static function subwords($str, $int, $strAppend = '...') {
        if (strlen($str) > $int) {
            $arr = str_word_count($str, 2);
            $blubb = false;
            foreach ($arr as $intPos => $strWord) {
                if ($blubb)
                    return substr($str, 0, $intPos) . $strAppend;
                if ($intPos > $int)
                    $blubb = true;
            }
        }
        return $str;
    }

    static function clearWhitespaces($string) {
        return trim(preg_replace('/\s+/s', " ", $string));
    }

    static function htmlValue($string) {
        return str_replace('"', "&quot;", $string);
    }

    static function jsValue($string) {
        return preg_replace('/\r?\n/', "\\n", str_replace('"', "\\\"", str_replace("'", "\\'", $string)));
    }

    static function xmlData($string, $cdata = false) {
        $string = str_replace("]]>", "]]]]><![CDATA[>", $string);
        if (!$cdata)
            $string = "<![CDATA[$string]]>";
        return $string;
    }

    static function compressCSS($code) {
        $code = self::clearWhitespaces($code);
        $code = preg_replace('/ ?\{ ?/', "{", $code);
        $code = preg_replace('/ ?\} ?/', "}", $code);
        $code = preg_replace('/ ?\; ?/', ";", $code);
        $code = preg_replace('/ ?\> ?/', ">", $code);
        $code = preg_replace('/ ?\, ?/', ",", $code);
        $code = preg_replace('/ ?\: ?/', ":", $code);
        $code = str_replace(";}", "}", $code);
        return $code;
    }

    /** Reqursively create all directories in given path if they are not exists.
     * Returns TRUE on success or false on fail.
     * @param string $dir
     * @param integer $mode
     * @return bool */
    static function rmkdir($dir, $mode = 0755) {
        $dir = preg_replace('/\/{2,}/s', "/", $dir);
        $dirs = explode("/", $dir);
        $curr = "";
        foreach ($dirs as $i => $cdir) {
            if (($i == 0) && ($cdir == ""))
                $curr .= "/";
            elseif ($i == 0)
                $curr .= $cdir;
            else
                $curr .= "/$cdir";
            if (!is_dir($curr) &&
                    !@mkdir($curr, $mode)
            )
                return false;
        }
        return true;
    }

    public static function shorten($text, $limit = 25) {
        if (strlen($text) > $limit) {
            $pre = substr($text, 0, ($limit / 2));
            $suf = substr($text, -($limit / 2));
            $text = $pre . ' ... ' . $suf;
        }
        return $text;
    }

    public static function GetOptionAction($action) {
        $optionHtml = array('rev' => '');
        $optionHtml['action'] = $action;
        if ($optionHtml['action'] == 'create') {
            $optionHtml['rev'] = 'common-check-name';
            $optionHtml['span'] = '<span id="load-img-check"></span>';
        }
        return $optionHtml;
    }
    public static function getTmp()
	{
		$tmpFolder = _APP_PATH_.DIRECTORY_SEPARATOR."data".DIRECTORY_SEPARATOR."tmp".DIRECTORY_SEPARATOR;
        if(!is_dir($tmpFolder)) mkdir($tmpFolder, 0777, true);
        return $tmpFolder;
	}
    public static function warningNoJavaScript(){
        return '<noscript>
                <div class="noscript">
                    <div class="noscript-inner">
                        <p><strong>JavaScript seem to be disabled in your browser.</strong></p>
                        <p>You must have JavaScript enabled in your browser to utilize the functionality of this website.</p>
                    </div>
                </div>
            </noscript>';
    }
}

?>